import request from "@/utils/request";

export function getDepts(params) {
  return request({
    url: "rest/api/organization",
    method: "get",
    params
  });
}

export function getDeptSuperior(ids) {
  const data = ids.length || ids.length === 0 ? ids : Array.of(ids);
  return request({
    url: "rest/api/organization/superior",
    method: "post",
    data
  });
}

export function add(data) {
  return request({
    url: "rest/api/organization",
    method: "post",
    data
  });
}

export function del(ids) {
  return request({
    url: "rest/api/organization/del",
    method: "post",
    data: ids
  });
}

export function edit(data) {
  return request({
    url: "rest/api/organization/update",
    method: "post",
    data
  });
}

export default { add, edit, del, getDepts, getDeptSuperior };
